<?php
namespace Home\Controller;
use Think\Controller;
	class ActDataController extends CommonController{
		
		public function create(){
			
			$m=D('ActData');
			if(!$m->create()){
				$this->show('error');
			}
			$idNum=$m->add();
			if($idNum>0){
				$act = D('Act'); // 
    			$act-> where('id='.$_POST['act_id'])->setInc('join_num');//点击数 字段加1
				
				$this->show('ok');
			}else{
				$this->show('error');
			}
		}

	public function checkphone(){
		$art=M('ActData');
		$data = array(
			'phone'=>$_POST['phone'],
			'art_id'=>$_POST['art_id']
		);
		$count = $art-> where($data)->find();
		if($count == null){
			$this->show("ok");
		}else{
			$this->show("error");
		}
    }
		
		public function joinAct(){
			$id = $_GET['id'];
			$title = M('Act')->where('id='.$id)->getField('title');
			$this->assign('title',$title);
			$this->assign('act_id',$id);
			$this->display('Act/joinact');
		}
	}
?>
